<include file="Public:header" />
<script type="text/javascript" src="__PUBLIC__/js/kindeditor-all-min.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/zh_CN.js"></script>
<script src="__PUBLIC__/js/PCASClass.js" type="text/javascript"></script>
<script type="text/javascript" src="__PUBLIC__/js/formValidator-4.0.1.min.js" charset="UTF-8"></script>
<script type="text/javascript" src="__PUBLIC__/js/formValidatorRegex.js" charset="UTF-8"></script>
<link rel="stylesheet" href="__PUBLIC__/css/kindeditor.css" type="text/css" />

<div class="container">
    <!-- Docs nav ================================================== -->
    <div class="page-header">
        <h4>{:L('DECISIONMAKER')}</h4>
    </div>
    <div class="row">
        <div class="span12">
            <include file="Public:alert" />
                    <div class="bs-component">
                        <ul class="nav nav-tabs responsive">
                            <li class="active">
                                <a data-toggle="tab" href="#tab1">{:L('DECISIONMAKER1')}</a>
                            </li>
                            <li>
                                <a data-toggle="tab" href="#tab2">{:L('SCORER')}</a>
                            </li>
                            <li>
                                <a data-toggle="tab" href="#tab3">{:L('RECOMMEND')}</a>
                            </li>
                            <li>
                                <a data-toggle="tab" href="#tab4">{:L('MESUSER')}</a>
                            </li>
                        </ul>

                        <div class="tab-content">
                            <div id="tab1" class="tab-pane fade active in">
                                <form id="form1" action="{:U(customer/decision_edit)}" method="post">
                                    <table class="table" width="33%" border="0" cellspacing="1" cellpadding="0">
                                        <tbody>
                                        <tr style="display: none;">
                                            <td class="tdleft" width="15%">{:L('PRINCIPAL')}:</td>
                                            <td>
                                                <input type="hidden" name="role_type" id="role_type" value="decisionmaker" /> &nbsp;&nbsp;
                                                <input type="hidden" name="cid" id="cid" value="{$dm.id}" /> &nbsp;&nbsp;
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="tdleft" width="15%">{:L('CUSTOMER_ID')}:</td>
                                            <td><input type="text" id="customer_name" name="customer_name" value="{$org_name}" readonly></td>
                                        </tr>
                                        <tr style="display: none;">
                                            <td class="tdleft" width="15%">{:L('CUSTOMER_ID')}:</td>
                                            <td><input type="text" id="customer_id" name="customer_id" value="{$customer_id}" readonly></td>
                                        </tr>
                                        <tr>
                                            <td class="tdleft" width="15%">{:L('CHANCE_ID')}:</td>
                                            <td>
                                                <select id="chance_id" onchange="changeCondition()" name="chance_id">
                                                    <option class="" value="">--{:L('PLEASE_CHOOSE_CHANGE_ID')}--</option>
                                                    <volist name="rs_business" id="vo">
                                                        <eq name="vo.business_id" value="$dm.chance_id">
                                                            <option class="" value="{$vo.business_id}" rel="customer" selected>{$vo.name}</option>
                                                            <else />
                                                            <option class="" value="{$vo.business_id}" rel="customer">{$vo.name}</option>
                                                        </eq>
                                                    </volist>
                                                </select>&nbsp;&nbsp;
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="tdleft" width="15%">{:L('DECISION_MAKER')}:</td>
                                            <td><input type="text" id="decision_maker" name="decision_maker" value="{$dm.name}">&nbsp;<span style="color:red;">*(必填)</span></td>
                                        </tr>
                                        <tr>
                                            <td class="tdleft" width="15%">{:L('PARTION')}:</td>
                                            <td><input type="text" id="partion" name="partion" value="{$dm.department}">&nbsp;<span style="color:red;">*(必填)</span></td>
                                        </tr>
                                        <tr>
                                            <td class="tdleft" width="15%">{:L('CONNECTION')}:</td>
                                            <td><input type="text" id="connection" name="connection" value="{$dm.contact_phone}">&nbsp;<span style="color:red;">*(必填)</span></td>
                                        </tr>
                                        <tr>
                                            <td class="tdleft" width="15%">{:L('FAMILY_MEMBER')}:</td>
                                            <td><input type="text" id="family_member" name="family_member" value="{$dm.family}"></td>
                                        </tr>
                                        <tr>
                                            <td class="tdleft" width="15%">{:L('HOBBY')}:</td>
                                            <td><input type="text" id="hobby" name="hobby" value="{$dm.like}"></td>
                                        </tr>
                                        <tr>
                                            <td class="tdleft" width="15%">{:L('DECISION_SEX')}:</td>
                                            <td>
                                                <input type="radio" placeholder="性别"  name="decision_sex" value="0"  <if condition="$dm['sex'] eq 0"> checked </if> class="">男
                                                <input type="radio" placeholder="性别" name="decision_sex" value="1" <if condition="$dm['sex'] eq 1"> checked </if> class="">女
                                                &nbsp;&nbsp;
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="tdleft" width="15%">{:L('DECISION_AGE')}:</td>
                                            <td><input type="text" id="decision_age" name="decision_age" value="{$dm.age}"></td>
                                        </tr>
                                        <tr>
                                            <td class="tdleft" width="15%">{:L('DECISION_BIRTHDAY')}:</td>
                                            <td><input type="text" value="{$dm.birthday}" id="decision_birthday" name="decision_birthday" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})"></td>
                                        </tr>
                                        </tbody>
                                        <tfoot>
                                        <tr>
                                            <td style="text-align:left;" colspan="10">
                                                <input class="btn btn-primary" name="submit" type="submit" value="{:L('SAVE')}"/>&nbsp;&nbsp;
                                                <!--<input class="btn btn-primary" name="submit" type="submit" value="{:L('SAVE_AND_NEW')}"/>&nbsp;&nbsp;-->
                                                <input class="btn" type="button" onclick="javascript:history.go(-1)" value="{:L('RETURN')}"/>&nbsp;
                                            </td>
                                        </tr>
                                        </tfoot>
                                    </table>
                                </form>
                            </div>
                            <div id="tab2" class="tab-pane fade active">
                                <form id="form2" action="{:U(customer/decision_edit)}" method="post">
                                    <table class="table" width="33%" border="0" cellspacing="1" cellpadding="0">

                                            <tbody id="tbody_1">
                                            <tr style="display: none;">
                                                <td class="tdleft" width="15%">{:L('PRINCIPAL')}:</td>
                                                <td>
                                                    <input type="hidden" id="owner_id" name="scorer[1][owner_role_id]" value="{$Think.session.role_id}"/>
                                                    <input type="text" id="role_type" name="scorer[1][role_type]" value="scorer" />
                                                    <input type="text" id="owner_name" value="{$Think.session.name}" /> &nbsp;&nbsp;
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="tdleft" width="15%">{:L('CUSTOMER_ID')}:</td>
                                                <td><input type="text" id="scorer_name" name="scorer[1][scorer_name]" value="{$org_name}" readonly></td>
                                            </tr>
                                            <tr style="display: none;">
                                                <td class="tdleft" width="15%">{:L('CUSTOMER_ID')}:</td>
                                                <td><input type="text" id="score_member_id" name="scorer[1][score_member_id]" value="{$dm.customer_id}" readonly></td>
                                            </tr>
                                            <tr>
                                                <td class="tdleft" width="15%">{:L('SCORER_MEMBER')}:</td>
                                                <td><input type="text" id="score_member" name="scorer[1][score_member]" value="">&nbsp;<span style="color:red;">*(必填)</span></td>
                                            </tr>
                                            <tr>
                                                <td class="tdleft" width="15%">{:L('PARTION')}:</td>
                                                <td><input type="text" id="scorer_partion" name="scorer[1][scorer_partion]" value="">&nbsp;<span style="color:red;">*(必填)</span></td>
                                            </tr>
                                            <tr>
                                                <td class="tdleft" width="15%">{:L('CONNECTION')}:</td>
                                                <td><input type="text" id="scorer_connection" name="scorer[1][scorer_connection]" value="">&nbsp;<span style="color:red;">*(必填)</span></td>
                                            </tr>
                                            <tr>
                                                <td class="tdleft" width="15%">{:L('FAMILY_MEMBER')}:</td>
                                                <td><input type="text" id="scorer_family_member" name="scorer[1][scorer_family_member]" value=""></td>
                                            </tr>
                                            <tr>
                                                <td class="tdleft" width="15%">{:L('HOBBY')}:</td>
                                                <td><input type="text" id="scorer_hobby" name="scorer[1][scorer_hobby]" value=""></td>
                                            </tr>
                                            <tr>
                                                <td class="tdleft" width="15%">{:L('DECISION_SEX')}:</td>
                                                <td>
                                                    <input type="radio" placeholder="性别"  name="scorer[1][scorer_decision_sex]" value="0"class="">男
                                                    <input type="radio" placeholder="性别" name="scorer[1][scorer_decision_sex]" value="1" class="">女
                                                    &nbsp;&nbsp;
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="tdleft" width="15%">{:L('DECISION_AGE')}:</td>
                                                <td><input type="text" id="scorer_decision_age" name="scorer[1][scorer_decision_age]" value=""></td>
                                            </tr>
                                            <tr>
                                                <td class="tdleft" width="15%">{:L('DECISION_BIRTHDAY')}:</td>
                                                <td><input type="text" value="" id="scorer_decision_birthday" name="scorer[1][scorer_decision_birthday]" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})"></td>
                                                <td style="text-align:left;">
                                                    <input class="btn btn-primary" id="formset_add" name="scorer[1][formset_add]" value="添加"/>
                                                </td>
                                            </tr>
                                            </tbody>
                                        <tfoot>
                                        <tr>
                                            <td style="text-align:left;" colspan="10">
                                                <input class="btn btn-primary" name="submit" type="submit" value="{:L('SAVE')}"/>&nbsp;&nbsp;
                                                <!--<input class="btn btn-primary" name="submit" type="submit" value="{:L('SAVE_AND_NEW')}"/>&nbsp;&nbsp;-->
                                                <input class="btn" type="button" onclick="javascript:history.go(-1)" value="{:L('RETURN')}"/>&nbsp;
                                            </td>
                                        </tr>
                                        </tfoot>
                                    </table>
                                </form>
                            </div>
                            <div id="tab3" class="tab-pane fade active">
                                <form id="form3" action="{:U(customer/decision_edit)}" method="post">
                                    <table class="table" width="33%" border="0" cellspacing="1" cellpadding="0">
                                                <tbody id="tbody_r1">
                                                <tr style="display: none;">
                                                    <td class="tdleft" width="15%">{:L('PRINCIPAL')}:</td>
                                                    <td>
                                                        <input type="hidden" id="owner_id" name="recommender[1][owner_role_id]" value="{$Think.session.role_id}"/>
                                                        <input type="text" id="role_type" name="role_type" value="recommender" />
                                                        <input type="text" id="owner_name" value="{$Think.session.name}" /> &nbsp;&nbsp;
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td class="tdleft" width="15%">{:L('CUSTOMER_ID')}:</td>
                                                    <td><input type="text" id="recommender_name" name="recommender[1][recommend_name]" value="{$org_name}" readonly></td>
                                                </tr>
                                                <tr style="display: none;">
                                                    <td class="tdleft" width="15%">{:L('CUSTOMER_ID')}:</td>
                                                    <td><input type="text" id="recommender_customer_id" name="customer_id" value="{$customer_id}" readonly></td>
                                                </tr>
                                                <tr>
                                                    <td class="tdleft" width="15%">{:L('RECOMMEND_MEMBER')}:</td>
                                                    <td><input type="text" id="recommender_decision_maker" name="recommender[1][recommende_decision_maker]" value="">&nbsp;<span style="color:red;">*(必填)</span></td>
                                                </tr>
                                                <tr>
                                                    <td class="tdleft" width="15%">{:L('PARTION')}:</td>
                                                    <td><input type="text" id="recommender_partion" name="recommender[1][recommende_partion]" value="">&nbsp;<span style="color:red;">*(必填)</span></td>
                                                </tr>
                                                <tr>
                                                    <td class="tdleft" width="15%">{:L('CONNECTION')}:</td>
                                                    <td><input type="text" id="recommender_connection" name="recommender[1][recommende_connection]" value="">&nbsp;<span style="color:red;">*(必填)</span></td>
                                                </tr>
                                                <tr>
                                                    <td class="tdleft" width="15%">{:L('FAMILY_MEMBER')}:</td>
                                                    <td><input type="text" id="recommender_family_member" name="recommender[1][recommende_family_member]" value=""></td>
                                                </tr>
                                                <tr>
                                                    <td class="tdleft" width="15%">{:L('HOBBY')}:</td>
                                                    <td><input type="text" id="recommender_hobby" name="recommender[1][recommende_hobby]" value=""></td>
                                                </tr>
                                                <tr>
                                                    <td class="tdleft" width="15%">{:L('DECISION_SEX')}:</td>
                                                    <td>
                                                        <input type="radio" placeholder="性别"  name="recommender[1][recommende_decision_sex]" value="0" class="">男
                                                        <input type="radio" placeholder="性别" name="recommender[1][recommende_decision_sex]" value="1" class="">女
                                                        &nbsp;&nbsp;
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td class="tdleft" width="15%">{:L('DECISION_AGE')}:</td>
                                                    <td><input type="text" id="recommender_decision_age" name="recommender[1][recommende_decision_age]" value=""></td>
                                                </tr>
                                                <tr>
                                                    <td class="tdleft" width="15%">{:L('DECISION_BIRTHDAY')}:</td>
                                                    <td><input type="text" value="" id="recommender_decision_birthday" style="width: 21%;" name="recommender[1][recommende_decision_birthday]" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})"></td>
                                                    <td style="text-align:left;">
                                                        <input class="btn btn-primary" id="recommender_formset_add" name="recommender[1][formset_add]" value="添加"/>
                                                    </td>
                                                </tr>
                                                </tbody>
                                        <tfoot>
                                        <tr>
                                            <td style="text-align:left;" colspan="10">
                                                <input class="btn btn-primary" name="submit" type="submit" value="{:L('SAVE')}"/>&nbsp;&nbsp;
                                                <!--<input class="btn btn-primary" name="submit" type="submit" value="{:L('SAVE_AND_NEW')}"/>&nbsp;&nbsp;-->
                                                <input class="btn" type="button" onclick="javascript:history.go(-1)" value="{:L('RETURN')}"/>&nbsp;
                                            </td>
                                        </tr>
                                        </tfoot>
                                    </table>
                                    <if condition="$leads['leads_id']"><input type="hidden" name="leads_id" value="{$leads['leads_id']}"/></if>
                                </form>
                            </div>
                            <div id="tab4" class="tab-pane fade active">
                                <form id="form4" action="{:U(customer/decision_edit)}" method="post">
                                    <table class="table" width="33%" border="0" cellspacing="1" cellpadding="0">
                                                <tbody id="tbody_m1">
                                                <tr style="display: none;">
                                                    <td class="tdleft" width="15%">{:L('PRINCIPAL')}:</td>
                                                    <td>
                                                        <input type="hidden" id="owner_id" name="meswayuser[1][owner_role_id]" value="{$Think.session.role_id}"/>
                                                        <input type="text" id="role_type" name="meswayuser" value="meswayuser" />
                                                        <input type="text" id="owner_name" value="{$Think.session.name}" /> &nbsp;&nbsp;
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td class="tdleft" width="15%">{:L('CUSTOMER_ID')}:</td>
                                                    <td><input type="text" id="customer_name" name="meswayuser[1][customer_name]" value="{$org_name}" readonly></td>
                                                </tr>
                                                <tr style="display: none;">
                                                    <td class="tdleft" width="15%">{:L('CUSTOMER_ID')}:</td>
                                                    <td><input type="text" id=",eswayuser_customer_id" name="customer_id" value="{$customer_id}" readonly></td>
                                                </tr>
                                                <tr>
                                                    <td class="tdleft" width="15%">{:L('MESUSER_MEMBER')}:</td>
                                                    <td><input type="text" id="mesuser_decision_maker" name="meswayuser[1][mesuser_decision_maker]" value="">&nbsp;<span style="color:red;">*(必填)</span></td>
                                                </tr>
                                                <tr>
                                                    <td class="tdleft" width="15%">{:L('PARTION')}:</td>
                                                    <td><input type="text" id="mesuser_partion" name="meswayuser[1][mesuser_partion]" value="">&nbsp;<span style="color:red;">*(必填)</span></td>
                                                </tr>
                                                <tr>
                                                    <td class="tdleft" width="15%">{:L('CONNECTION')}:</td>
                                                    <td><input type="text" id="mesuser_connection" name="meswayuser[1][mesuser_connection]" value="">&nbsp;<span style="color:red;">*(必填)</span></td>
                                                </tr>
                                                <tr>
                                                    <td class="tdleft" width="15%">{:L('FAMILY_MEMBER')}:</td>
                                                    <td><input type="text" id="mesuser_family_member" name="meswayuser[1][mesuser_family_member]" value=""></td>
                                                </tr>
                                                <tr>
                                                    <td class="tdleft" width="15%">{:L('HOBBY')}:</td>
                                                    <td><input type="text" id="mesuser_hobby" name="meswayuser[1][mesuser_hobby]" value=""></td>
                                                </tr>
                                                <tr>
                                                    <td class="tdleft" width="15%">{:L('DECISION_SEX')}:</td>
                                                    <td>
                                                        <input type="radio" placeholder="性别"  name="meswayuser[1][mesuser_decision_sex]" value="0" class="">男
                                                        <input type="radio" placeholder="性别" name="meswayuser[1][mesuser_decision_sex]" value="1" class="">女
                                                        &nbsp;&nbsp;
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td class="tdleft" width="15%">{:L('DECISION_AGE')}:</td>
                                                    <td><input type="text" id="mesuser_decision_age" name="meswayuser[1][mesuser_decision_age]" value=""></td>
                                                </tr>
                                                <tr>
                                                    <td class="tdleft" width="15%">{:L('DECISION_BIRTHDAY')}:</td>
                                                    <td><input type="text" value="" id="mesuser_decision_birthday" style="width: 21%;" name="meswayuser[1][mesuser_decision_birthday]" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})"></td>
                                                    <td style="text-align:left;">
                                                        <input class="btn btn-primary" id="meswayuser_formset_add" name="meswayuser[1][formset_add]" value="添加"/>
                                                    </td>
                                                </tr>
                                                </tbody>
                                        <tfoot>
                                        <tr>
                                            <td style="text-align:left;" colspan="10">
                                                <input class="btn btn-primary" name="submit" type="submit" value="{:L('SAVE')}"/>&nbsp;&nbsp;
                                                <!--<input class="btn btn-primary" name="submit" type="submit" value="{:L('SAVE_AND_NEW')}"/>&nbsp;&nbsp;-->
                                                <input class="btn" type="button" onclick="javascript:history.go(-1)" value="{:L('RETURN')}"/>&nbsp;
                                            </td>
                                        </tr>
                                        </tfoot>
                                    </table>
                                </form>
                            </div>
                        </div>
                    </div>

        </div>
    </div>
</div>
<script type="text/javascript">
        $(function(){
            //------表单字段验证部分------
            //决策者
            $.formValidator.initConfig({formID:"form1",debug:false,submitOnce:true,
                onError:function(msg,obj,errorlist){
                    alert(msg);
                },
                submitAfterAjaxPrompt : '有数据正在异步验证，请稍等...'
            });
            $("#decision_maker").formValidator({
                tipID:"nameTip",
                onShow:"<span style='color:red;'>*必填项</span>",
                empty:false,
                onFocus:" ",
                onCorrect:"<span style='color:green;'>√</span>"
            }).inputValidator({
                min:1,max:333,
                onshow:"<font style='color:red;'>决策者姓名不能为空！</font>",
                onErrorMin:"决策者姓名不能为空！",
                onErrorMax:"客户名称超出最大长度"
            });
            $("#partion").formValidator({
                tipID:"addressTip",
                onShow:"<span style='color:red;'>*必填项</span>",
                empty:false,
                onFocus:" ",
                onCorrect:"<span style='color:green;'>√</span>"
            }).inputValidator({
                min:1,max:500,
                onshow:"<font style='color:red;'>决策者所在部门不能为空！</font>",
                onErrorMin:"决策者所在部门不能为空！",
                onErrorMax:"决策者所在部门不能为空超出最大长度"
            });
            $('#connection').formValidator({
                ValidatorGroup : '1',
                onEmpty : '手机号码不能为空',
                onShow : '',
                onFocus : '请输入您的手机号码',
                onCorrect : '手机号码格式正确',
            })
                    .regexValidator({
                        regExp : '^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$',
                        onError : '手机号码格式有误，请从新输入'
                    });

            //评价者判断
//            $("#score_member").formValidator({
//                tipID:"nameTip",
//                onShow:"<span style='color:red;'>*必填项</span>",
//                empty:false,
//                onFocus:" ",
//                onCorrect:"<span style='color:green;'>√</span>"
//            }).inputValidator({
//                min:1,max:333,
//                onshow:"<font style='color:red;'>决策者姓名不能为空！</font>",
//                onErrorMin:"决策者姓名不能为空！",
//                onErrorMax:"客户名称超出最大长度"
//            });
//            $("#score_partion").formValidator({
//                tipID:"addressTip",
//                onShow:"<span style='color:red;'>*必填项</span>",
//                empty:false,
//                onFocus:" ",
//                onCorrect:"<span style='color:green;'>√</span>"
//            }).inputValidator({
//                min:1,max:500,
//                onshow:"<font style='color:red;'>决策者所在部门不能为空！</font>",
//                onErrorMin:"决策者所在部门不能为空！",
//                onErrorMax:"决策者所在部门不能为空超出最大长度"
//            });
//            $('#score_connection').formValidator({
//                ValidatorGroup : '1',
//                onEmpty : '手机号码不能为空',
//                onShow : '',
//                onFocus : '请输入您的手机号码',
//                onCorrect : '手机号码格式正确',
//            })
//                    .regexValidator({
//                        regExp : '^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$',
//                        onError : '手机号码格式有误，请从新输入'
//                    });
//
//
//            //推荐者判断
//            $("#recommende_decision_maker").formValidator({
//                tipID:"nameTip",
//                onShow:"<span style='color:red;'>*必填项</span>",
//                empty:false,
//                onFocus:" ",
//                onCorrect:"<span style='color:green;'>√</span>"
//            }).inputValidator({
//                min:1,max:333,
//                onshow:"<font style='color:red;'>决策者姓名不能为空！</font>",
//                onErrorMin:"决策者姓名不能为空！",
//                onErrorMax:"客户名称超出最大长度"
//            });
//            $("#recommende_partion").formValidator({
//                tipID:"addressTip",
//                onShow:"<span style='color:red;'>*必填项</span>",
//                empty:false,
//                onFocus:" ",
//                onCorrect:"<span style='color:green;'>√</span>"
//            }).inputValidator({
//                min:1,max:500,
//                onshow:"<font style='color:red;'>决策者所在部门不能为空！</font>",
//                onErrorMin:"决策者所在部门不能为空！",
//                onErrorMax:"决策者所在部门不能为空超出最大长度"
//            });
//            $('#recommende_connection').formValidator({
//                ValidatorGroup : '1',
//                onEmpty : '手机号码不能为空',
//                onShow : '',
//                onFocus : '请输入您的手机号码',
//                onCorrect : '手机号码格式正确',
//            })
//                    .regexValidator({
//                        regExp : '^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$',
//                        onError : '手机号码格式有误，请从新输入'
//                    });
//
//            //使用者判断
//            $("#mesuser_decision_maker").formValidator({
//                tipID:"nameTip",
//                onShow:"<span style='color:red;'>*必填项</span>",
//                empty:false,
//                onFocus:" ",
//                onCorrect:"<span style='color:green;'>√</span>"
//            }).inputValidator({
//                min:1,max:333,
//                onshow:"<font style='color:red;'>决策者姓名不能为空！</font>",
//                onErrorMin:"决策者姓名不能为空！",
//                onErrorMax:"客户名称超出最大长度"
//            });
//            $("#mesuser_partion").formValidator({
//                tipID:"addressTip",
//                onShow:"<span style='color:red;'>*必填项</span>",
//                empty:false,
//                onFocus:" ",
//                onCorrect:"<span style='color:green;'>√</span>"
//            }).inputValidator({
//                min:1,max:500,
//                onshow:"<font style='color:red;'>决策者所在部门不能为空！</font>",
//                onErrorMin:"决策者所在部门不能为空！",
//                onErrorMax:"决策者所在部门不能为空超出最大长度"
//            });
//            $('#mesuser_connection').formValidator({
//                ValidatorGroup : '1',
//                onEmpty : '手机号码不能为空',
//                onShow : '',
//                onFocus : '请输入您的手机号码',
//                onCorrect : '手机号码格式正确',
//            })
//                    .regexValidator({
//                        regExp : '^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$',
//                        onError : '手机号码格式有误，请从新输入'
//                    });





            //动态生成表单部分
            var i=1;
            $(document).on('click','#formset_add',function(){
                i++;
                xx = '';
                xx +='<tbody id="tbody_'+(i)+'"> <tr style="display: none;"> <td class="tdleft" width="15%">{:L(\'PRINCIPAL\')}:</td> <td> <input type="hidden" id="owner_id" name="scorer['+i+'][owner_role_id]" value="{$Think.session.role_id}"/> <input type="text" id="role_type" name="scorer['+i+'][role_type]" value="scorer" /> <input type="text" id="owner_name" value="{$Think.session.name}" /> &nbsp;&nbsp; </td> </tr> <tr> <td class="tdleft" width="15%">{:L(\'CUSTOMER_ID\')}:</td> <td><input type="text" id="scorer_name" name="scorer['+i+'][scorer_name]" value="{$org_name}" readonly></td> </tr> <tr style="display: none;"> <td class="tdleft" width="15%">{:L(\'CUSTOMER_ID\')}:</td> <td><input type="text" id="score_member_id" name="scorer['+i+'][score_member_id]" value="{$dm.customer_id}" readonly></td> </tr> <tr> <td class="tdleft" width="15%">{:L(\'SCORER_MEMBER\')}:</td> <td><input type="text" id="score_member" name="scorer['+i+'][score_member]" value="">&nbsp;<span style="color:red;">*(必填)</span></td> </tr> <tr> <td class="tdleft" width="15%">{:L(\'PARTION\')}:</td> <td><input type="text" id="scorer_partion" name="scorer['+i+'][scorer_partion]" value="">&nbsp;<span style="color:red;">*(必填)</span></td> </tr> <tr> <td class="tdleft" width="15%">{:L(\'CONNECTION\')}:</td> <td><input type="text" id="scorer_connection" name="scorer['+i+'][scorer_connection]" value="">&nbsp;<span style="color:red;">*(必填)</span></td> </tr> <tr> <td class="tdleft" width="15%">{:L(\'FAMILY_MEMBER\')}:</td> <td><input type="text" id="scorer_family_member" name="scorer['+i+'][scorer_family_member]" value=""></td> </tr> <tr> <td class="tdleft" width="15%">{:L(\'HOBBY\')}:</td> <td><input type="text" id="scorer_hobby" name="scorer['+i+'][scorer_hobby]" value=""></td> </tr> <tr> <td class="tdleft" width="15%">{:L(\'DECISION_SEX\')}:</td> <td> <input type="radio" placeholder="性别"name="scorer['+i+'][scorer_decision_sex]" value="0"class="">男 <input type="radio" placeholder="性别" name="scorer['+i+'][scorer_decision_sex]" value="1" class="">女 &nbsp;&nbsp; </td> </tr> <tr> <td class="tdleft" width="15%">{:L(\'DECISION_AGE\')}:</td> <td><input type="text" id="scorer_decision_age" name="scorer['+i+'][scorer_decision_age]" value=""></td> </tr> <tr> <td class="tdleft" width="15%">{:L(\'DECISION_BIRTHDAY\')}:</td> <td><input type="text" value="" id="scorer_decision_birthday" name="scorer['+i+'][scorer_decision_birthday]"></td> <td style="text-align:left;"><input class="btn btn-primary" id="formset_add" name="scorer['+i+'][formset_add]" value="添加"></td></tr> </tbody>';
//                $(this).css('display','none');
                $(this).replaceWith('<td style="text-align:left;"><input class="btn btn-primary" id="formset_delete" name="scorer['+i+'][formset_add]" value="删除" onClick="javascript:deletethis('+(i-1)+')"></td>');
//                $("#tab2 table.table tfoot").before('')
                $("#tab2 table.table tfoot").before(xx);
            });

            //推荐者
            $(document).on('click','#recommender_formset_add',function(){
                i++;
                xx = '';
                xx +='<tbody id="tbody_r'+(i)+'"><tr style="display: none;"> <td class="tdleft" width="15%">{:L(\'PRINCIPAL\')}:</td> <td> <input type="hidden" id="owner_id" name="recommender['+i+'][owner_role_id]" value="{$Think.session.role_id}"/> <input type="text" id="role_type" name="recommender['+i+'][role_type]" value="recommender" /> <input type="text" id="owner_name" value="{$Think.session.name}" /> &nbsp;&nbsp; </td></tr><tr> <td class="tdleft" width="15%">{:L(\'CUSTOMER_ID\')}:</td> <td><input type="text" id="recommend_name" name="recommender['+i+'][recommend_name]" value="{$org_name}" readonly></td></tr><tr style="display: none;"> <td class="tdleft" width="15%">{:L(\'CUSTOMER_ID\')}:</td> <td><input type="text" id="recommend_customer_id" name="recommender['+i+'][customer_id]" value="{$dm.customer_id}" readonly></td></tr><tr> <td class="tdleft" width="15%">{:L(\'RECOMMEND_MEMBER\')}:</td> <td><input type="text" id="recommende_decision_maker" name="recommender['+i+'][recommende_decision_maker]" value="">&nbsp;<span style="color:red;">*(必填)</span></td></tr><tr> <td class="tdleft" width="15%">{:L(\'PARTION\')}:</td> <td><input type="text" id="recommende_partion" name="recommender['+i+'][recommende_partion]" value="">&nbsp;<span style="color:red;">*(必填)</span></td></tr><tr> <td class="tdleft" width="15%">{:L(\'CONNECTION\')}:</td> <td><input type="text" id="recommende_connection" name="recommender['+i+'][recommende_connection]" value="">&nbsp;<span style="color:red;">*(必填)</span></td></tr><tr> <td class="tdleft" width="15%">{:L(\'FAMILY_MEMBER\')}:</td> <td><input type="text" id="recommende_family_member" name="recommender['+i+'][recommende_family_member]" value=""></td></tr><tr> <td class="tdleft" width="15%">{:L(\'HOBBY\')}:</td> <td><input type="text" id="recommende_hobby" name="recommender['+i+'][recommende_hobby]" value=""></td></tr><tr> <td class="tdleft" width="15%">{:L(\'DECISION_SEX\')}:</td> <td> <input type="radio" placeholder="性别"name="recommender['+i+'][recommende_decision_sex]" value="0" class="">男 <input type="radio" placeholder="性别" name="recommender['+i+'][recommende_decision_sex]" value="1" class="">女 &nbsp;&nbsp; </td></tr><tr> <td class="tdleft" width="15%">{:L(\'DECISION_AGE\')}:</td> <td><input type="text" id="recommende_decision_age" name="recommender['+i+'][recommende_decision_age]" value=""></td></tr><tr> <td class="tdleft" width="15%">{:L(\'DECISION_BIRTHDAY\')}:</td> <td><input type="text" value="" id="recommende_decision_birthday" style="width: 21%;" name="recommender['+i+'][recommende_decision_birthday]"></td> <td style="text-align:left;"><input class="btn btn-primary" id="recommende_formset_add" name="recommender['+i+'][recommender_formset_add]" value="添加"></td></tr> </tbody>';
//                $(this).css('display','none');
                $(this).replaceWith('<td style="text-align:left;"><input class="btn btn-primary" id="formset_delete" name="recommender['+i+'][recommender_formset_add]" value="删除" onClick="javascript:deleterthis('+(i-1)+')"></td>');
//                $("#tab2 table.table tfoot").before('')
                $("#tab3 table.table tfoot").before(xx);
            });

            //使用者
            $(document).on('click','#meswayuser_formset_add',function(){
                i++;
                alert(i);
                xx = '';
                xx +='<tbody id="tbody_m'+(i)+'"><tr style="display: none;">    <td class="tdleft" width="15%">{:L(\'PRINCIPAL\')}:</td>    <td>        <input type="hidden" id="owner_id" name="meswayuser['+i+'][owner_role_id]" value="{$Think.session.role_id}"/>        <input type="text" id="role_type" name="role_type" value="meswayuser" />        <input type="text" id="owner_name" value="{$Think.session.name}" /> &nbsp;&nbsp;    </td></tr><tr>    <td class="tdleft" width="15%">{:L(\'CUSTOMER_ID\')}:</td>    <td><input type="text" id="customer_name" name="meswayuser['+i+'][customer_name]" value="{$org_name}" readonly></td></tr><tr style="display: none;">    <td class="tdleft" width="15%">{:L(\'CUSTOMER_ID\')}:</td>    <td><input type="text" id="meswayuser_customer_id" name="customer_id" value="{$customer_id}" readonly></td></tr><tr>    <td class="tdleft" width="15%">{:L(\'MESUSER_MEMBER\')}:</td>    <td><input type="text" id="mesuser_decision_maker" name="meswayuser['+i+'][mesuser_decision_maker]" value="">&nbsp;<span style="color:red;">*(必填)</span></td></tr><tr>    <td class="tdleft" width="15%">{:L(\'PARTION\')}:</td>    <td><input type="text" id="mesuser_partion" name="meswayuser['+i+'][mesuser_partion]" value="">&nbsp;<span style="color:red;">*(必填)</span></td></tr><tr>    <td class="tdleft" width="15%">{:L(\'CONNECTION\')}:</td>    <td><input type="text" id="mesuser_connection" name="meswayuser['+i+'][mesuser_connection]" value="">&nbsp;<span style="color:red;">*(必填)</span></td></tr><tr>    <td class="tdleft" width="15%">{:L(\'FAMILY_MEMBER\')}:</td>    <td><input type="text" id="mesuser_family_member" name="meswayuser['+i+'][mesuser_family_member]" value=""></td></tr><tr>    <td class="tdleft" width="15%">{:L(\'HOBBY\')}:</td>    <td><input type="text" id="mesuser_hobby" name="meswayuser['+i+'][mesuser_hobby]" value=""></td></tr><tr>    <td class="tdleft" width="15%">{:L(\'DECISION_SEX\')}:</td>    <td>        <input type="radio" placeholder="性别"  name="meswayuser['+i+'][mesuser_decision_sex]" value="0" class="">男        <input type="radio" placeholder="性别" name="meswayuser['+i+'][mesuser_decision_sex]" value="1" class="">女        &nbsp;&nbsp;    </td></tr><tr>    <td class="tdleft" width="15%">{:L(\'DECISION_AGE\')}:</td>    <td><input type="text" id="mesuser_decision_age" name="meswayuser['+i+'][mesuser_decision_age]" value=""></td></tr><tr>    <td class="tdleft" width="15%">{:L(\'DECISION_BIRTHDAY\')}:</td>    <td><input type="text" value="" id="mesuser_decision_birthday" style="width: 21%;" name="meswayuser['+i+'][mesuser_decision_birthday]"></td> <td style="text-align:left;"><input class="btn btn-primary" id="meswayuser_formset_add" name="meswayuser['+i+'][meswayuser_formset_add]" value="添加"></td></tr> </tbody>';
//                $(this).css('display','none');
                $(this).replaceWith('<td style="text-align:left;"><input class="btn btn-primary" id="formset_delete" name="meswayuser['+i+'][meswayuser_formset_add]" value="删除" onClick="javascript:deletemthis('+(i-1)+')"></td>');
//                $("#tab2 table.table tfoot").before('')
                $("#tab4 table.table tfoot").before(xx);
            });
    });

function deletethis(id){
    alert(id);
    var dom="#tbody_"+id;
    alert(dom);
    $(dom).remove();
}

function deleterthis(id){
    alert(id);
    var dom="#tbody_r"+id;
    alert(dom);
    $(dom).remove();
}

function deletemthis(id){
    alert(id);
    var dom="#tbody_m"+id;
    alert(dom);
    $(dom).remove();
}
</script>
<include file="Public:footer" />
